﻿<%@ Page Language="C#" MasterPageFile="~/Admin/AdminMasterPage.master" AutoEventWireup="true"
    CodeFile="Grades.aspx.cs" Inherits="Admin_Grades" Title="Admin Page - Information Literacy Education" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit.HTMLEditor"
    TagPrefix="cc1" %>
<%@ Register TagPrefix="uc" TagName="UpdateProgress" Src="~/UserControls/UpdateProgress.ascx" %>
<%@ Register TagPrefix="uc" TagName="ModalPopupMessage" Src="~/UserControls/ModalPopupMessage.ascx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cphMain" runat="Server">
    <uc:UpdateProgress ID="updateProgress" runat="server" />
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <uc:ModalPopupMessage ID="ModalPopupMessage" runat="server" />
        </ContentTemplate>
    </asp:UpdatePanel>
    <h1>
        Grade Section Page
    </h1>
    <%--<asp:UpdatePanel ID="UpdatePanel2" runat="server">
        <ContentTemplate>--%>
            <div style="margin-left: 20px;">
                <br />
                <h2>
                    Assignments &amp; Grades</h2>
                <div style="margin-left: 20px;">
                    <h3>
                        Classes</h3>
                    <div style="min-width: 600px; margin-left: 20px; border: solid 1px #999; padding: 10px;">
                        <table>
                            <tr>
                                <td class="tableLeftHeader">
                                    Class * :
                                </td>
                                <td class="tableItem">
                                    <asp:DropDownList ID="ddlistClasses" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlistClasses_SelectedIndexChanged">
                                    </asp:DropDownList>
                                </td>
                            </tr>
                            <asp:Panel ID="PanelSection" runat="server" Visible="false">
                                <tr>
                                    <td class="tableLeftHeader">
                                        Section # * :
                                    </td>
                                    <td class="tableItem">
                                        <asp:DropDownList ID="ddlistSections" runat="server" OnSelectedIndexChanged="ddlistSections_SelectedIndexChanged"
                                            AutoPostBack="True">
                                        </asp:DropDownList>
                                    </td>
                                </tr>
                            </asp:Panel>
                        </table>
                    </div>
                    <br />
                    <asp:Panel ID="PanelAssignments" runat="server" Visible="false">
                        <h3>
                            Assignments</h3>
                        <div style="margin-left: 20px; border: solid 1px #999; padding: 10px;">
                            <table>
                                <tr>
                                    <td class="tableLeftHeader">
                                        Assignment Type :
                                    </td>
                                    <td class="tableItem">
                                        <asp:RadioButtonList ID="rdobtnsAssignmentType" runat="server" RepeatDirection="Horizontal"
                                            AutoPostBack="true" OnSelectedIndexChanged="rdobtnsAssignmentType_SelectedIndexChanged">
                                            <asp:ListItem Selected="True" Value="Quiz">Quiz</asp:ListItem>
                                            <asp:ListItem Value="Essay">Essay</asp:ListItem>
                                        </asp:RadioButtonList>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="tableLeftHeader">
                                        Standard :
                                    </td>
                                    <td class="tableItem">
                                        <asp:RadioButtonList ID="rdobtnsAssignmentStandard" runat="server" RepeatDirection="Horizontal"
                                            AutoPostBack="true" OnSelectedIndexChanged="rdobtnsAssignmentStandard_SelectedIndexChanged">
                                            <asp:ListItem Selected="True" Value="1">Getting Started</asp:ListItem>
                                            <asp:ListItem Value="2">Finding Sources</asp:ListItem>
                                            <asp:ListItem Value="3">Evaluating Sources</asp:ListItem>
                                            <asp:ListItem Value="4">Writing with Sources</asp:ListItem>
                                            <asp:ListItem Value="0">All</asp:ListItem>
                                        </asp:RadioButtonList>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="tableLeftHeader">
                                        Upcoming Assignments:
                                    </td>
                                    <td class="tableItem">
                                        <asp:RadioButtonList ID="rdobtnsAssignmentDue" runat="server" RepeatDirection="Horizontal"
                                            AutoPostBack="true" OnSelectedIndexChanged="rdobtnsAssignmentDue_SelectedIndexChanged">
                                            <asp:ListItem Selected="True" Value="All">All</asp:ListItem>
                                            <asp:ListItem Value="Before">Upcoming Assignments</asp:ListItem>
                                            <asp:ListItem Value="Past">Ended Assignments</asp:ListItem>
                                        </asp:RadioButtonList>
                                    </td>
                                </tr>
                            </table>
                            <br />
                            <asp:ObjectDataSource ID="ObjectDataSourceAssignments" runat="server" OldValuesParameterFormatString="original_{0}"
                                SelectMethod="GetAssignmentsByTypeAndStandardIdAndPastDue" TypeName="AssignmentsBLL">
                                <SelectParameters>
                                    <asp:SessionParameter Name="CourseID" SessionField="CourseID" Type="Int32" />
                                    <asp:SessionParameter Name="SectionNumber" SessionField="SectionNumber" Type="Int32" />
                                    <asp:ControlParameter ControlID="rdobtnsAssignmentStandard" Name="StandardID" PropertyName="SelectedValue"
                                        Type="Int32" />
                                    <asp:ControlParameter ControlID="rdobtnsAssignmentType" Name="Type" PropertyName="SelectedValue"
                                        Type="String" />
                                    <asp:ControlParameter ControlID="rdobtnsAssignmentDue" Name="PastDue" PropertyName="SelectedValue"
                                        Type="String" />
                                </SelectParameters>
                            </asp:ObjectDataSource>
                            <asp:GridView ID="GridViewAssignments" runat="server" AllowPaging="True" AllowSorting="True"
                                AutoGenerateColumns="False" CellPadding="4" DataKeyNames="AssignmentID" DataSourceID="ObjectDataSourceAssignments"
                                ForeColor="#333333" GridLines="None" EmptyDataText="<div class='nodata'>No Assignments Found</div>"
                                OnSelectedIndexChanged="GridViewAssignments_SelectedIndexChanged" Width="700px">
                                <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
                                <RowStyle BackColor="#E3EAEB" />
                                <Columns>
                                    <asp:CommandField ShowSelectButton="True" SelectText="View" />
                                    <asp:BoundField DataField="AssignmentTitle" HeaderText="Assignment Title" SortExpression="AssignmentTitle">
                                    </asp:BoundField>
                                    <asp:BoundField DataField="StartDateTime" HeaderText="Start Time" SortExpression="StartDateTime">
                                        <HeaderStyle HorizontalAlign="Center" />
                                        <ItemStyle HorizontalAlign="Center" />
                                    </asp:BoundField>
                                    <asp:BoundField DataField="EndDateTime" HeaderText="Due Date" SortExpression="EndDateTime">
                                        <HeaderStyle HorizontalAlign="Center" />
                                        <ItemStyle HorizontalAlign="Center" />
                                    </asp:BoundField>
                                </Columns>
                                <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
                                <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
                                <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
                                <EditRowStyle BackColor="#7C6F57" />
                                <AlternatingRowStyle BackColor="White" />
                            </asp:GridView>
                        </div>
                        <br />
                    </asp:Panel>
                    <asp:Panel ID="PanelAssignmentGrades" runat="server" Visible="false">
                        <h3>
                            Grades
                        </h3>
                        <div style="margin-left: 20px; border: solid 1px #999; padding: 10px;">
                            <%--<div id="assignmentStats">
                                <table>
                                    <tr>
                                        <td class="tableLeftHeader">
                                            # of Students submitted assignment :
                                        </td>
                                        <td class="tableItem">
                                            <asp:Label ID="lblNoOfStudentsSubmittedAssignment" runat="server" />
                                        </td>
                                    </tr>
                                </table>
                            </div>--%>
                            <asp:Panel ID="PanelQuizAssignment" runat="server" Visible="false">
                                <asp:CheckBox ID="chkboxQuizShowQuestionStats" runat="server" Text="Show Questions and Statistics"
                                    AutoPostBack="true" OnCheckedChanged="chkboxQuizShowQuestionStats_CheckedChanged" />
                                <asp:Panel ID="PanelQuizShowQuestionStats" runat="server" Visible="false">
                                    <div style="margin-left: 20px;">
                                        <h4>
                                            Quiz Question Stats</h4>
                                        <asp:XmlDataSource ID="XmlDataSourceQuizQuestionStats" runat="server" XPath="quizassignment/questions/question" />
                                        <asp:Repeater ID="RepeaterQuizQuestionsStats" runat="server" DataSourceID="XmlDataSourceQuizQuestionStats">
                                            <HeaderTemplate>
                                                <table style="min-width: 600px; border-spacing: 0px;">
                                                    <tr>
                                                        <td class="tableTopHeader" style="width: 40px;">
                                                            Req.
                                                        </td>
                                                        <td class="tableTopHeader" style="width: 0px;">
                                                            
                                                        </td>
                                                        <td class="tableTopHeader" style="width: 0px;">
                                                            
                                                        </td>
                                                        <td class="tableTopHeader">
                                                        </td>
                                                        <td class="tableTopHeader" style="width: 80px;">
                                                            Sect. Stats
                                                        </td>
                                                        <td class="tableTopHeader" style="width: 80px;">
                                                            Overall Stats
                                                        </td>
                                                    </tr>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <tr>
                                                    <td style="text-align: center;">
                                                        <asp:CheckBox ID="chkboxEditRequiredOverview" runat="server" CssClass="HiddenText"
                                                            Text='<%# XPath("@learnobjid").ToString() + ";" + XPath("@id").ToString()%>'
                                                            Checked='<%# Convert.ToBoolean(XPath("@defaultrequired").ToString()) %>' Enabled="false" />
                                                    </td>
                                                    <td style="text-align: center;">
                                                        <%--<%# XPath("@difficulty") %>--%>
                                                    </td>
                                                    <td style="text-align: center;">
                                                        <%--<%# XPath("@point") %>--%>
                                                    </td>
                                                    <td>
                                                        <%# XPath("questiontext") %>
                                                    </td>
                                                    <td style="text-align: center;">
                                                        <%# GetClassSectionQuestionStats(Convert.ToInt32(XPath("@learnobjid")), Convert.ToInt32(XPath("@id")), Convert.ToInt32(Session["CourseID"]), Convert.ToInt32(Session["SectionNumber"]), true)%>/<%# GetClassSectionQuestionStats(Convert.ToInt32(XPath("@learnobjid")), Convert.ToInt32(XPath("@id")), Convert.ToInt32(Session["CourseID"]), Convert.ToInt32(Session["SectionNumber"]), false) + GetClassSectionQuestionStats(Convert.ToInt32(XPath("@learnobjid")), Convert.ToInt32(XPath("@id")), Convert.ToInt32(Session["CourseID"]), Convert.ToInt32(Session["SectionNumber"]), true)%>
                                                        <br />
                                                        <%# GetClassSectionQuestionStatsPercentage(Convert.ToInt32(XPath("@learnobjid")), Convert.ToInt32(XPath("@id")), Convert.ToInt32(Session["CourseID"]), Convert.ToInt32(Session["SectionNumber"])).ToString("P")%>
                                                    </td>
                                                    <td style="text-align: center;">
                                                        <%# GetQuestionStats(Convert.ToInt32(XPath("@learnobjid")), Convert.ToInt32(XPath("@id")), true)%>/<%# GetQuestionStats(Convert.ToInt32(XPath("@learnobjid")), Convert.ToInt32(XPath("@id")), false) + GetQuestionStats(Convert.ToInt32(XPath("@learnobjid")), Convert.ToInt32(XPath("@id")), true)%>
                                                        <br />
                                                        <%# GetQuestionStatsPercentage(Convert.ToInt32(XPath("@learnobjid")), Convert.ToInt32(XPath("@id"))).ToString("P")%>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                    </td>
                                                    <td>
                                                    </td>
                                                    <td>
                                                    </td>
                                                    <td>
                                                        <asp:Repeater ID="RepeaterChoices" runat="server" DataSource='<%# XPathSelect("choices/choice") %>'>
                                                            <HeaderTemplate>
                                                                <ul>
                                                            </HeaderTemplate>
                                                            <ItemTemplate>
                                                                <li>
                                                                    <%# XPath(".") %>
                                                                    &nbsp;
                                                                    <asp:Image ID="imgCorrectAnswer" runat="server" ImageUrl="~/Images/correct_answer.gif"
                                                                        Visible='<%# Convert.ToBoolean(XPath("@iscorrectanswer").ToString()) %>' />
                                                                </li>
                                                            </ItemTemplate>
                                                            <FooterTemplate>
                                                                </ul>
                                                            </FooterTemplate>
                                                        </asp:Repeater>
                                                    </td>
                                                    <td>
                                                    </td>
                                                </tr>
                                            </ItemTemplate>
                                            <FooterTemplate>
                                                </table>
                                            </FooterTemplate>
                                        </asp:Repeater>
                                    </div>
                                    <hr />
                                </asp:Panel>
                                <br />
                                <table style="width: 700px;">
                                    <tr>
                                        <td class="tableLeftHeader">
                                            Filter Option :
                                        </td>
                                        <td class="tableItem">
                                            <asp:RadioButtonList ID="rdobtnsQuizFilter" runat="server" RepeatDirection="Horizontal"
                                                AutoPostBack="true" OnSelectedIndexChanged="rdobtnsQuizFilter_SelectedIndexChanged">
                                                <asp:ListItem Selected="True" Value="Highest">View Highest Grades</asp:ListItem>
                                                <asp:ListItem Value="Lowest">View Lowest Grades</asp:ListItem>
                                                <asp:ListItem Value="All">View All Grades</asp:ListItem>
                                            </asp:RadioButtonList>
                                        </td>
                                    </tr>
                                </table>
                                <div style="width: 700px; text-align: right; margin-top: -45px; margin-bottom: 40px;">
                                    <b>Average: <asp:Label ID="lblQuizGradeAverage" runat="server" /></b>
                                </div>
                                <asp:ObjectDataSource ID="ObjectDataSourceQuizGrades" runat="server" OldValuesParameterFormatString="original_{0}"
                                    SelectMethod="GetQuizSubmissionsByAssignmentIdAndCourseIdAndSectionNumberAndFilter"
                                    TypeName="AssignmentsSubmissionsBLL">
                                    <SelectParameters>
                                        <asp:ControlParameter ControlID="GridViewAssignments" Name="AssignmentID" PropertyName="SelectedValue"
                                            Type="Int32" />
                                        <asp:SessionParameter Name="CourseID" SessionField="CourseID" Type="Int32" />
                                        <asp:SessionParameter Name="SectionNumber" SessionField="SectionNumber" Type="Int32" />
                                        <asp:ControlParameter ControlID="rdobtnsQuizFilter" Name="Filter" PropertyName="SelectedValue"
                                            Type="String" />
                                    </SelectParameters>
                                </asp:ObjectDataSource>
                                <asp:GridView ID="GridViewQuizGrades" runat="server" AllowSorting="True"
                                    AutoGenerateColumns="False" CellPadding="4" 
                                    DataKeyNames="QuizSubmissionID" DataSourceID="ObjectDataSourceQuizGrades"
                                    ForeColor="#333333" GridLines="None" Width="700px" EmptyDataText="<div class='nodata'>No Submissions Found</div>"
                                    OnSelectedIndexChanged="GridViewQuizGrades_SelectedIndexChanged">
                                    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                    <RowStyle BackColor="#EFF3FB" />
                                    <Columns>
                                        <asp:CommandField ShowSelectButton="True" SelectText="View Details" />
                                        <asp:BoundField DataField="Username" HeaderText="Username" 
                                            SortExpression="Username" />
                                        <asp:BoundField DataField="StudentIDNumber" HeaderText="Student ID#" SortExpression="StudentIDNumber" />
                                        <asp:BoundField DataField="LastName" HeaderText="Last Name" SortExpression="LastName" />
                                        <asp:BoundField DataField="FirstName" HeaderText="First Name" SortExpression="FirstName" />
                                        <asp:TemplateField HeaderText="Grade" SortExpression="GradePercentage">
                                            <ItemTemplate>
                                                <asp:Label ID="lblGradePercentage" runat="server" Text='<%# Bind("GradePercentage") %>' />
                                                %
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" />
                                            <ItemStyle HorizontalAlign="Right" />
                                        </asp:TemplateField>
                                        <asp:BoundField DataField="SubmittedDateTime" HeaderText="Submitted Time" SortExpression="SubmittedDateTime">
                                            <HeaderStyle HorizontalAlign="Center" />
                                            <ItemStyle HorizontalAlign="Center" />
                                        </asp:BoundField>
                                    </Columns>
                                    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                                    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                    <EditRowStyle BackColor="#2461BF" />
                                    <AlternatingRowStyle BackColor="White" />
                                </asp:GridView>
                                <br />
                                <div style="width: 700px; text-align: center;">
                                    <asp:Button ID="btnQuizGradesExportToExcel" runat="server" Text="Export All Grades to Excel"
                                        OnClick="btnQuizGradesExportToExcel_Click" />
                                    <ajaxToolkit:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" TargetControlID="btnQuizGradesExportToExcel"
                                        ConfirmText="Are you sure you want to export 'All Grades shown above' to Excel?" />
                                    &nbsp;&nbsp;
                                    <asp:Button ID="btnSendAllQuizGrades" runat="server" Text="Email Quiz Grades to All Students"
                                        OnClick="btnSendAllQuizGrades_Click" />
                                    <ajaxToolkit:ConfirmButtonExtender ID="ConfirmButtonExtender2" runat="server" TargetControlID="btnSendAllQuizGrades"
                                        ConfirmText="Are you sure you want to send students quiz results?" />
                                </div>
                            </asp:Panel>
                            <asp:Panel ID="PanelEssayAssignment" runat="server" Visible="false">
                                <table style="width: 600px;">
                                    <tr>
                                        <td class="tableLeftHeader">
                                            Filter Option :
                                        </td>
                                        <td class="tableItem">
                                            <asp:RadioButtonList ID="rdobtnsEssayFilter" runat="server" RepeatDirection="Horizontal"
                                                AutoPostBack="true" OnSelectedIndexChanged="rdobtnsEssayFilter_SelectedIndexChanged">
                                                <asp:ListItem Selected="True" Value="All">View All</asp:ListItem>
                                                <asp:ListItem Value="NotGraded">Not Graded</asp:ListItem>
                                                <asp:ListItem Value="Graded">Graded</asp:ListItem>
                                            </asp:RadioButtonList>
                                        </td>
                                    </tr>
                                </table>
                                <asp:ObjectDataSource ID="ObjectDataSourceEssayGrades" runat="server" OldValuesParameterFormatString="original_{0}"
                                    SelectMethod="GetEssaySubmissionsByAssignmentIdAndCourseIdAndSectionNumberAndFilter"
                                    TypeName="AssignmentsSubmissionsBLL">
                                    <SelectParameters>
                                        <asp:ControlParameter ControlID="GridViewAssignments" Name="AssignmentID" PropertyName="SelectedValue"
                                            Type="Int32" />
                                        <asp:SessionParameter Name="CourseID" SessionField="CourseID" Type="Int32" />
                                        <asp:SessionParameter Name="SectionNumber" SessionField="SectionNumber" Type="Int32" />
                                        <asp:ControlParameter ControlID="rdobtnsEssayFilter" Name="Filter" PropertyName="SelectedValue"
                                            Type="String" />
                                    </SelectParameters>
                                </asp:ObjectDataSource>
                                <asp:GridView ID="GridViewEssayGrades" runat="server" AllowPaging="True" AllowSorting="True"
                                    AutoGenerateColumns="False" CellPadding="4" DataKeyNames="EssaySubmissionID"
                                    DataSourceID="ObjectDataSourceEssayGrades" ForeColor="#333333" GridLines="None"
                                    Width="700px" EmptyDataText="<div class='nodata'>No Submissions Found</div>"
                                    OnSelectedIndexChanged="GridViewEssayGrades_SelectedIndexChanged">
                                    <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                    <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                    <Columns>
                                        <asp:CommandField ShowSelectButton="True" SelectText="View Details" />
                                        <asp:BoundField DataField="Username" HeaderText="Username" 
                                            SortExpression="Username" />
                                        <asp:BoundField DataField="StudentIDNumber" HeaderText="Student ID#" SortExpression="StudentIDNumber" />
                                        <asp:BoundField DataField="LastName" HeaderText="Last Name" SortExpression="LastName" />
                                        <asp:BoundField DataField="FirstName" HeaderText="First Name" SortExpression="FirstName" />
                                        <asp:BoundField DataField="Grade" HeaderText="Grade" SortExpression="Grade">
                                            <HeaderStyle HorizontalAlign="Center" />
                                        </asp:BoundField>
                                        <asp:CheckBoxField DataField="IsFinal" HeaderText="Final?" SortExpression="IsFinal">
                                            <HeaderStyle HorizontalAlign="Center" />
                                            <ItemStyle HorizontalAlign="Center" />
                                        </asp:CheckBoxField>
                                        <asp:BoundField DataField="SubmittedDateTime" HeaderText="Submitted Date Time" SortExpression="SubmittedDateTime">
                                            <HeaderStyle HorizontalAlign="Center" />
                                            <ItemStyle HorizontalAlign="Center" />
                                        </asp:BoundField>
                                    </Columns>
                                    <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                                    <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                                    <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                    <EditRowStyle BackColor="#999999" />
                                    <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                                </asp:GridView>
                                <div style="padding: 20px;">
                                    <asp:Button ID="btnEssayGradesExportToExcel" runat="server" Text="Export All Essay Grades to Excel"
                                        OnClick="btnEssayGradesExportToExcel_Click" />
                                    <ajaxToolkit:ConfirmButtonExtender ID="ConfirmButtonExtender6" runat="server" TargetControlID="btnEssayGradesExportToExcel"
                                        ConfirmText="Are you sure you want to export 'All Grades shown above' to Excel?" />
                                    &nbsp;&nbsp;
                                    <asp:Button ID="btnSendAllEssayGrades" runat="server" Text="Email Essay Submissions to All Students"
                                        OnClick="btnSendAllEssayGrades_Click" />
                                    <ajaxToolkit:ConfirmButtonExtender ID="ConfirmButtonExtender8" runat="server" TargetControlID="btnSendAllEssayGrades"
                                        ConfirmText="Are you sure you want to email all the 'graded' essay submissions to students?\n(Submissions that are not graded yet will not be sent.)" />
                                </div>
                            </asp:Panel>
                        </div>
                        <br />
                    </asp:Panel>
                    <asp:Panel ID="PanelDetails" runat="server" Visible="false">
                        <h3>
                            Details
                        </h3>
                        <div style="margin-left: 20px; border: solid 1px #999; padding: 10px;">
                            <asp:Panel ID="PanelQuizSubmissionDetails" runat="server" Visible="false">
                                <h4>
                                    Student Answers</h4>
                                <br />
                                <div style="margin-left: 10px;">
                                    <asp:XmlDataSource ID="XmlDataSourceQuizSubmission" runat="server" XPath="quizsubmission/questions/question" />
                                    <asp:Repeater ID="RepeaterQuizStudentSubmission" runat="server" DataSourceID="XmlDataSourceQuizSubmission">
                                        <HeaderTemplate>
                                            <table style="width: 700px; border-spacing: 0px;">
                                                <tr>
                                                    <td class="tableTopHeader" style="width: 40px;">
                                                        Req.
                                                    </td>
                                                    <td class="tableTopHeader" style="width: 0px;">
                                                        
                                                    </td>
                                                    <td class="tableTopHeader" style="width: 0px;">
                                                        
                                                    </td>
                                                    <td class="tableTopHeader" style="width: 20px;">
                                                    </td>
                                                    <td class="tableTopHeader">
                                                        Questions
                                                    </td>
                                                    <td class="tableTopHeader" style="width: 60px;">
                                                        Stats.
                                                    </td>
                                                </tr>
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                            <tr>
                                                <td style="text-align: center;">
                                                    <asp:CheckBox ID="chkboxRequired" runat="server" CssClass="HiddenText" Checked='<%# Convert.ToBoolean(XPath("@required").ToString()) %>'
                                                        Enabled="false" />
                                                </td>
                                                <td style="text-align: center;">
                                                    <%--<%# XPath("@difficulty") %>--%>
                                                </td>
                                                <td style="text-align: center;">
                                                    <%--<%# XPath("@point") %>--%>
                                                </td>
                                                <td style="width: 20px;">
                                                </td>
                                                <td>
                                                    <%# XPath("questiontext") %>
                                                </td>
                                                <td style="text-align: center;">
                                                    <%# GetQuestionStats(Convert.ToInt32(XPath("@learnobjid")), Convert.ToInt32(XPath("@id")), true)%>
                                                    /<%# GetQuestionStats(Convert.ToInt32(XPath("@learnobjid")), Convert.ToInt32(XPath("@id")), false) + GetQuestionStats(Convert.ToInt32(XPath("@learnobjid")), Convert.ToInt32(XPath("@id")), true)%>
                                                    &nbsp;
                                                    <%# GetQuestionStatsPercentage(Convert.ToInt32(XPath("@learnobjid")), Convert.ToInt32(XPath("@id"))).ToString("P")%>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                </td>
                                                <td>
                                                </td>
                                                <td>
                                                </td>
                                                <td style="width: 20px;">
                                                </td>
                                                <td>
                                                    <asp:Repeater ID="RepeaterChoices" runat="server" DataSource='<%# XPathSelect("choices/choice") %>'>
                                                        <HeaderTemplate>
                                                            <ul>
                                                        </HeaderTemplate>
                                                        <ItemTemplate>
                                                            <li>
                                                                <%# XPath(".") %>
                                                                &nbsp;
                                                                <asp:Image ID="imgCorrectAnswer" runat="server" ImageUrl="~/Images/correct_answer.gif"
                                                                    Visible='<%# Convert.ToBoolean(XPath("@iscorrectanswer").ToString()) %>' />
                                                                <asp:Label ID="lblIsStudentAnswer" runat="server" Text="Student's Answer" Visible='<%# Convert.ToBoolean(XPath("@isstudentanswer").ToString()) %>' />
                                                            </li>
                                                        </ItemTemplate>
                                                        <FooterTemplate>
                                                            </ul>
                                                        </FooterTemplate>
                                                    </asp:Repeater>
                                                </td>
                                                <td>
                                                </td>
                                            </tr>
                                        </ItemTemplate>
                                        <AlternatingItemTemplate>
                                            <tr style="background-color: #EEE;">
                                                <td style="text-align: center;">
                                                    <asp:CheckBox ID="chkboxRequired" runat="server" CssClass="HiddenText" Checked='<%# Convert.ToBoolean(XPath("@required").ToString()) %>'
                                                        Enabled="false" />
                                                </td>
                                                <td style="text-align: center;">
                                                    <%--<%# XPath("@difficulty") %>--%>
                                                </td>
                                                <td style="text-align: center;">
                                                    <%--<%# XPath("@point") %>--%>
                                                </td>
                                                <td style="width: 20px;">
                                                </td>
                                                <td>
                                                    <%# XPath("questiontext") %>
                                                </td>
                                                <td style="text-align: center;">
                                                    <%# GetQuestionStats(Convert.ToInt32(XPath("@learnobjid")), Convert.ToInt32(XPath("@id")), true)%>
                                                    /<%# GetQuestionStats(Convert.ToInt32(XPath("@learnobjid")), Convert.ToInt32(XPath("@id")), false) + GetQuestionStats(Convert.ToInt32(XPath("@learnobjid")), Convert.ToInt32(XPath("@id")), true)%>
                                                    &nbsp;
                                                    <%# GetQuestionStatsPercentage(Convert.ToInt32(XPath("@learnobjid")), Convert.ToInt32(XPath("@id"))).ToString("P")%>
                                                </td>
                                            </tr>
                                            <tr style="background-color: #EEE;">
                                                <td>
                                                </td>
                                                <td>
                                                </td>
                                                <td>
                                                </td>
                                                <td style="width: 20px;">
                                                </td>
                                                <td>
                                                    <asp:Repeater ID="RepeaterChoices" runat="server" DataSource='<%# XPathSelect("choices/choice") %>'>
                                                        <HeaderTemplate>
                                                            <ul>
                                                        </HeaderTemplate>
                                                        <ItemTemplate>
                                                            <li>
                                                                <%# XPath(".") %>
                                                                &nbsp;
                                                                <asp:Image ID="imgCorrectAnswer" runat="server" ImageUrl="~/Images/correct_answer.gif"
                                                                    Visible='<%# Convert.ToBoolean(XPath("@iscorrectanswer").ToString()) %>' />
                                                                <asp:Label ID="lblIsStudentAnswer" runat="server" Text="Student's Answer" Visible='<%# Convert.ToBoolean(XPath("@isstudentanswer").ToString()) %>' />
                                                            </li>
                                                        </ItemTemplate>
                                                        <FooterTemplate>
                                                            </ul>
                                                        </FooterTemplate>
                                                    </asp:Repeater>
                                                </td>
                                                <td>
                                                </td>
                                            </tr>
                                        </AlternatingItemTemplate>
                                        <FooterTemplate>
                                            </table>
                                        </FooterTemplate>
                                    </asp:Repeater>
                                    <br />
                                    <div>
                                        <asp:Button ID="btnSendQuizGrade" runat="server" Text="Email Quiz Grade" OnClick="btnSendQuizGrade_Click" />
                                        (All the Attempts)
                                        <ajaxToolkit:ConfirmButtonExtender ID="ConfirmButtonExtender4" runat="server" ConfirmText="Are you sure you want to do it?"
                                            TargetControlID="btnSendQuizGrade" />
                                    </div>
                                </div>
                            </asp:Panel>
                            <asp:Panel ID="PanelEssaySubmissionDetails" runat="server" Visible="false">
                                <asp:CheckBox ID="chkboxViewEssayQuestion" runat="server" Text="View Essay Question"
                                    AutoPostBack="true" OnCheckedChanged="chkboxViewEssayQuestion_CheckedChanged" />
                                <br />
                                <br />
                                <asp:Panel ID="PanelEssaySubmissionDetailsQuestion" runat="server" Visible="false">
                                    <h4>
                                        Essay Question</h4>
                                    <div style="margin-left: 10px; border: solid 1px #999; padding: 10px;">
                                        <asp:Label ID="lblEssayQuestion" runat="server" />
                                    </div>
                                    <br />
                                </asp:Panel>
                                <h4>
                                    Student Essay</h4>
                                <div style="margin-left: 10px; border: solid 1px #999; padding: 10px;">
                                    <asp:Label ID="lblStudentEssaySubmission" runat="server" />
                                </div>
                                <br />
                                <table>
                                    <tr>
                                        <td class="tableLeftHeader">
                                            Grade :
                                        </td>
                                        <td class="tableItem">
                                            <asp:TextBox ID="txtEssayGrade" runat="server" MaxLength="10" />
                                            &nbsp;
                                            <asp:Button ID="btnSubmitGrade" runat="server" Text="Grade this Essay" OnClick="btnSubmitGrade_Click" />
                                            <ajaxToolkit:ConfirmButtonExtender ID="ConfirmButtonExtender5" runat="server" TargetControlID="btnSubmitGrade"
                                                ConfirmText="Are you sure you want to grade this essay?" />
                                        </td>
                                    </tr>
                                </table>
                                <br />
                                <asp:CheckBox ID="chkboxEssaySubmissionComments" runat="server" Text="View Comments"
                                    AutoPostBack="true" OnCheckedChanged="chkboxEssaySubmissionComments_CheckedChanged" />
                                <br />
                                <br />
                                <asp:Panel ID="PanelEssaySubmissionComments" runat="server" Visible="false">
                                    <h4>
                                        Comments</h4>
                                    <div style="margin-left: 10px; border: solid 1px #999;">
                                        <asp:Repeater ID="RepeaterEssayComments" runat="server" OnItemDataBound="RepeaterEssayComments_ItemDataBound">
                                            <HeaderTemplate>
                                                <table style="min-width: 300px;">
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <tr>
                                                    <td style="vertical-align: top; font-weight: bold; text-decoration: underline; padding: 10px;">
                                                        <asp:Label ID="lblInstructor" runat="server" />
                                                        :
                                                    </td>
                                                    <td style="padding: 10px;">
                                                        <asp:Label ID="lblComment" runat="server" />
                                                        - <span style="font-size: smaller;">Commented on
                                                            <asp:Label ID="lblCommentDateTime" runat="server" /></span>
                                                    </td>
                                                </tr>
                                            </ItemTemplate>
                                            <FooterTemplate>
                                                </table>
                                            </FooterTemplate>
                                        </asp:Repeater>
                                        <br />
                                    </div>
                                    <br />
                                </asp:Panel>
                                <h4>
                                    My Comment
                                </h4>
                                <div style="margin-left: 10px; border: solid 1px #999; padding: 10px;">
                                    <cc1:Editor ID="EditorEssayComment" runat="server" Height="150" CssClass="MinWidth" />
                                    <br />
                                    <asp:Button ID="btnEssaySubmitComment" runat="server" Text="Submit My Comment" OnClick="btnEssaySubmitComment_Click" />
                                    <ajaxToolkit:ConfirmButtonExtender ID="ConfirmButtonExtender7" runat="server" TargetControlID="btnEssaySubmitComment"
                                        ConfirmText="Are you sure you want to submit your comment?" />
                                </div>
                                <br />
                                <h4>
                                    Options
                                </h4>
                                <div style="margin-left: 10px; border: none; padding: 10px;">
                                    <asp:Button ID="btnSendEssayGrade" runat="server" Text="Email Essay Information"
                                        OnClick="btnSendEssayGrade_Click" />
                                    <ajaxToolkit:ConfirmButtonExtender ID="ConfirmButtonExtender3" runat="server" ConfirmText="Are you sure you want to email essay information"
                                        TargetControlID="btnSendEssayGrade" />
                                </div>
                            </asp:Panel>
                        </div>
                    </asp:Panel>
                </div>
        <%--</ContentTemplate>
        <Triggers>
            <asp:PostBackTrigger ControlID="btnQuizGradesExportToExcel" />
            <asp:PostBackTrigger ControlID="btnEssayGradesExportToExcel" />
            <asp:PostBackTrigger ControlID="GridViewEssayGrades" />
        </Triggers>
    </asp:UpdatePanel>--%>
    </div>
</asp:Content>
